using System;

namespace TDUnit.Common.TestData
{
    public class DependencyColumn : Column
    {
        public DependencyColumn(string name, Column dependedOnColumn) : base(name)
        {
            if(dependedOnColumn == null)
                throw new ArgumentNullException("dependedOnColumn");

            DepenedOnColumn = dependedOnColumn;
        }

        public override string Value
        {
            get
            {
                return DepenedOnColumn.Value;
            }
            set
            {
                throw new InvalidOperationException("You cannot set Value on a DependencyColumn. The value comes from the DependedOnColumn.");
            }
        }

        public override bool ShouldQuote
        {
            get
            {
                return DepenedOnColumn.ShouldQuote;
            }
            set
            {
                throw new InvalidOperationException("You cannot set ShouldQuote on a DependencyColumn. The value comes from the DependedOnColumn.");
            }
        }
        public Column DepenedOnColumn { get; private set; }
    }
}